package net.dgg.zz.credential.generalCredential.dao;

import net.dgg.zz.api.credential.entity.SimpleGeneralCertificate;
import net.dgg.zz.credential.generalCredential.entity.*;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

@Component
public interface GeneralCertificateDao {
    int deleteByPrimaryKey(Long id);

    int insert(GeneralCertificate record);

    int insertSelective(GeneralCertificate record);

    GeneralCertificate selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(GeneralCertificate record);

    int updateByPrimaryKey(GeneralCertificate record);


    List<GeneralCertificate> queryGertificateInfo2(Map params);

    /**
     * 分页查询证书信息
     *
     * @param params
     * @return
     */
    List<GeneralCertificate> queryGertificateInfoWithPage(Map params);

    /**
     * 查询需要导出的数据
     *
     * @param params
     * @return
     */
    List<GeneralCredentialVo> queryExportCredential(Map params);

    /*
     * @Author zsx
     * @Date 2018-08-27 06:08:38
     * @Description  分页查询退回证书列表
     * @param params
     * @return List<GeneralCertificate>
     */
    List<GeneralCertificate> selectReturnCertificateByWithPage(Map<String, Object> params);

    /*
     * @Author zsx
     * @Date 2018-08-28 10:08:29
     * @Description 查询需要导出的退回证书数据
     * @param params
     * @return List<ReturnCertificateVo>
     */
    List<ReturnCertificateVo> selectExportRetenCredential(Map<String, Object> params);

    /**
     * 根据id查询证书信息(证书类型、证书专业取id)
     *
     * @param id
     * @return
     */
    GeneralCertificate queryGertificateInfoById(@Param("id") Long id);

    /*
     * @Author zsx
     * @Date 2018-08-29 09:08:40
     * @Description 根据baseId更新证书信息
     * @param record
     * @return int
     */
    int updateByPrimaryBaseId(GeneralCertificate record);

    /**
     * 根据证书编号查询证书
     *
     * @param certificateNo
     * @return
     */
    GeneralCertificate findCredentialByNo(@Param("certificateNo") String certificateNo);

    /**
     * 查询证书绑定的最新的销售子订单信息
     *
     * @param id
     * @return
     */
    Map findOrderBusinessInfoByCertificate(@Param("id") Long id);

    /**
     * 证书总览：证书统计
     *
     * @param params
     * @return
     */
    Map generalCredentialCount(Map params);


    /**
     * 根据生产订单id查询证书信息
     *
     * @param scProductOrderId
     * @return
     */
    GeneralCertificate queryGertificateInfoByScOrderId(@Param("scProductOrderId") Long scProductOrderId);


    /**
     * 根据生产订单id查询证书数量
     *
     * @param scProductOrderId
     * @return
     */
    int queryGertificateCountByScOrderId(@Param("scProductOrderId") Long scProductOrderId);

    /**
     * 根据id查询证书信息（证书专业、类型翻译）
     *
     * @param id
     * @return
     */
    GeneralCertificate queryGertificateById(Long id);

    /**
     * 根据生产订单id查询证书（证书新增时绑定的生产订单）
     *
     * @param id
     * @return
     */
    List<GeneralCertificate> queryGertificateByAddScOrderId(Long id);

    /*
     * @Author zsx
     * @Date 2018-10-23 10:10:11
     * @Description 查询全部导出数据
     */
    List<AllGeneralCredentialVo> queryExportAllCredential(Map params);

    List<Map> queryGertificateList();

    int updateGeneralCertificatePhone(Map params);

    /**
     * 查询入库列表
     * @param warehousing
     * @return
     */
    List<Warehousing> getWarehousingList(Warehousing warehousing);

    /**
     * 查询入库列表总数
     * @param warehousing
     * @return
     */
    int getCountWarehousingList(Warehousing warehousing);

    /**
     * 保存入库
     * @param warehousing
     * @return
     */
    int addWarehousing2(Warehousing warehousing);

    /**
     * 通过id查询入库信息
     * @param id
     * @return
     */
    Warehousing findWarehousingById(Long id);

    /**
     * 保存修改
     * @param warehousing
     * @return
     */
    int updateWarehousing(Warehousing warehousing);

    /**
     * 查询现有证书数量
     * @param params
     * @return
     */
    int getCurrentCount(Map params);

    /**
     * 查询设置的证书数量
     * @param params
     * @return
     */
    Integer getWarehousingCount(Map params);

    /**
     * 校验新增的入库信息是否存在
     * @param warehousing
     * @return
     */
    int selectWarehousing(Warehousing warehousing);

    /**
     * 保存使用信息
     * @param credential
     */
    int saveGeneralCertificate(GeneralCertificate credential);

    /**
     * 保存价格
     * @param credential
     * @return
     */
    int saveBaseCertificate(GeneralCertificate credential);

    /**listCredentialWithPage
     * 财务查询证书
     * @param params params
     * @return List<SimpleGeneralCertificate>
     */
    List<SimpleGeneralCertificate> listCredentialWithPage(Map params);


    int updateCertificateStatus(Map params);

    int updateCertificateStatusByGeneralType();

    List<Map> selectStorageCapacityCount();

    int updateCertificateStatusByCertificateCode(List<Map> list);

    List<Map> selectCertificateStatusCount(String code);

    int updateCertificateStatusByReservation(List<Map> list);

    int updateCertificateStatusByMatching(List<Map> list);

    int updateCertificateStatusByAffiliated(List<Map> list);


}